Skip to content

Conversation

@dleffel
Copy link
Collaborator

@dleffel dleffel commented Nov 4, 2025

Problem

Google Ads conversions were not being tracked in production. The window.gtag() function executed but sent no network requests to Google servers.

Root Cause Analysis

Two issues were preventing conversion tracking:

  1. wait_for_update: 500 was blocking all events

    • gtag waited 500ms for consent updates
    • When no update arrived and all consent was denied, all events were dropped
    • Result: Zero network requests, even for cookieless conversion pings
  2. Missing config re-initialization after consent granted

    • When users accepted cookies, consent was updated to 'granted'
    • However, gtag('config') was never called again to flush queued events
    • Result: Events remained queued but never sent

Solution

This PR implements two critical fixes:

1. Remove wait_for_update parameter

Removed the wait_for_update: 500 parameter from consent defaults. This allows gtag to send anonymized conversion pings immediately, even when consent is denied.

2. Re-initialize config after consent granted

Added window.gtag('config', GTM_ID) call in updateConsentGranted() function. When users accept cookies, this flushes any queued events and enables full conversion tracking.

Expected Behavior After Fix

WITHOUT user consent:

  • ✅ Anonymized conversion pings are sent to Google
  • ✅ No user data or cookies are used
  • ✅ Enables Google's conversion modeling
  • ✅ GDPR compliant

WITH user consent:

  • ✅ Full conversion tracking enabled
  • ✅ User data and cookies used for attribution
  • ✅ Complete conversion funnel tracking

Testing

To verify the fix works:

  1. Load /reviewer page
  2. Open DevTools → Network tab → Filter by 'google'
  3. You should now see requests to googleads.g.doubleclick.net
  4. Click 'Start 14-day Free Trial' button
  5. Verify conversion event is sent

Files Changed

  • apps/web-roo-code/src/components/providers/google-analytics-provider.tsx

Related Issues

Fixes the issue where Google Ads conversion tracking appeared to execute but sent no network requests in production.


Important

Fixes Google Ads conversion tracking by removing wait_for_update and re-initializing config after consent in google-analytics-provider.tsx.

  • Behavior:
    • Removed wait_for_update: 500 from consent defaults in google-analytics-provider.tsx to allow immediate anonymized conversion pings.
    • Added window.gtag('config', GTM_ID) in updateConsentGranted() to flush queued events after consent is granted.
  • Testing:
    • Verified by checking network requests to googleads.g.doubleclick.net on /reviewer page and after clicking 'Start 14-day Free Trial'.

This description was created by Ellipsis for 276d1ff. You can customize this summary. It will automatically update as commits are pushed.

This fixes two critical issues preventing Google Ads conversions from being tracked:

1. Removed wait_for_update parameter that was blocking all conversion pings
   - Previously, gtag waited 500ms for consent updates then dropped all events
   - Now sends cookieless conversion pings immediately when consent is denied

2. Re-initialize gtag config after consent is granted
   - When users accept cookies, gtag('config') is now called to flush queued events
   - This enables full conversion tracking with user data after consent

With these changes:
- WITHOUT consent: Anonymized conversion pings are sent for Google's conversion modeling
- WITH consent: Full conversion tracking with user data is enabled

Fixes the issue where window.gtag() executed but sent no network requests.
@dleffel dleffel requested review from cte, jr and mrubens as code owners November 4, 2025 05:48
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Nov 4, 2025
@roomote
Copy link

roomote bot commented Nov 4, 2025

See this task on Roo Code Cloud

Review complete. No issues found. The changes correctly implement Google Ads conversion tracking with consent mode by removing the blocking wait_for_update parameter and re-initializing the config after consent is granted.

Mention @roomote in a comment to trigger your PR Fixer agent and make changes to this pull request.

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

🚀 Preview deployed!

Your changes have been deployed to Vercel:

Preview URL: https://roo-code-website-hkxz7wsar-roo-code.vercel.app

This preview will be updated automatically when you push new commits to this PR.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 4, 2025
@dleffel dleffel closed this Nov 4, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Nov 4, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 4, 2025
@dleffel dleffel deleted the fix/google-ads-consent-tracking branch November 4, 2025 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants